﻿using BCCommon.TMS.MarketingCoupon;
using BCEntity.TMS.MarketingCoupon.MarketingCoupon;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace BCData.TMS.MarketingCoupon.MarketingCoupon
{
    public interface IMarketingCouponData
    {
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity">优惠券</param>
        /// <returns></returns>
        Task<MarketingCouponEntity> InsertAsync(MarketingCouponEntity entity);
        /// <summary>
        /// 添加
        /// </summary>
        /// <param name="entity">优惠券</param>
        /// <returns></returns>
        Task<int> InsertAllAsync(IEnumerable<MarketingCouponEntity> entities);
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="entity">优惠券</param>
        /// <returns></returns>
        Task<MarketingCouponEntity> UpdateAsync(MarketingCouponEntity entity);


        /// <summary>
        /// 修改优惠券是否可用
        /// </summary>
        /// <param name="entity">优惠券类型id</param>
        /// <returns></returns>
        Task<int> UpdateEnabledByTypeId(long marketingCouponTypeId, bool enabled);
        /// <summary>
        /// 获取信息
        /// </summary>
        /// <param name="MarketingCouponId">优惠券Id</param>
        /// <returns></returns>
        Task<MarketingCouponEntity> GetSingle(long MarketingCouponId);
        /// <summary>
        /// 获取第一条信息根据类型
        /// </summary>
        /// <param name="marketingCouponTypeId">优惠券类型Id</param>
        /// <returns></returns>
        Task<MarketingCouponEntity> GetFirst(long marketingCouponTypeId);
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="isEnabled">是否可用</param>
        /// <returns></returns>
        Task<IEnumerable<MarketingCouponEntity>> GetList(bool? isEnable);
        /// <summary>
        /// 获取分页
        /// </summary>
        /// <param name="marketingCouponTypeId">优惠券类型id</param>
        /// <param name="pageIndex"></param>
        /// <param name="pageSize"></param>
        /// <returns></returns>
        Task<(IEnumerable<MarketingCouponEntity>,int)> Query(long marketingCouponTypeId, bool? isReceive, bool? isUse, int pageIndex, int pageSize);
        /// <summary>
        /// 获取剩余的优惠券
        /// </summary>
        /// <param name="marketingCouponTypeId">优惠券类型id</param>
        /// <param name="agentRecordId">代理商id</param>
        /// <returns></returns>
        Task<MarketingCouponEntity> GetRemainMarketingCoupon(long marketingCouponTypeId, long agentRecordId);
        /// <summary>
        /// 获取可用的优惠券列表
        /// </summary>
        /// <param name="userId">用户id</param>
        /// <param name="vehicleTransportBusinessConfigId">运输类型id</param>
        /// <param name="countyCode">区编码</param>
        /// <returns></returns>
        Task<IEnumerable<MarketingCouponEntity>> GetCanUseList(long userId, long vehicleTransportBusinessConfigId, string countyCode);
        /// <summary>
        /// 获取用户优惠券列表(分页)
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="marketingCouponStatus"></param>
        /// <returns></returns>
        Task<(IEnumerable<MarketingCouponEntity>, int)> GetMarketingCouponList(long userId, MarketingCouponStatusEnum? marketingCouponStatus,
            int pageIndex, int pageSize);
    }
}
